package com.sm.auth.controller;


import com.sm.auth.entity.UmsSysUser;
import com.sm.auth.service.UserService;
import com.sm.auth.service.UserService;
import com.sm.common.response.Result;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("ums/sysuser")
public class UmsSysUserController {

    private final UserService userService;

    public UmsSysUserController(UserService userService) {
        this.userService = userService;
    }

    /**
     * 新增用户接口
     */
    //hellp
    @PostMapping
    public Result addSysUser(@RequestBody UmsSysUser user) {
        boolean flag = userService.save(user);
        if(flag) {
            return Result.success();
        }
        return Result.error();
    }

    /**
     * 查询用户列表接口
     */
    @GetMapping
    public Result searchList() {
        List<UmsSysUser> list = userService.list();
        list.forEach(System.out::println);
        return Result.success().put("data",list);
    }
}
